﻿$.validator.methods.date = function (value, element) {    
    return this.optional(element) || moment(value).format(_dateFormat);
};

$('.input-group.date').datetimepicker({
    language: $('#dtpBirthday').data('lang'),
    pickTime: false
});

function onSuccess(result) {    
    if (result.status === 200) {
        $('#editorModal').modal('hide');
        $('#formctnr').html('');
        if (result.html !== '') {
            var item = $('#userlist tr[data-id=' + result.id + ']');
            if (item.length > 0) {
                // Edit
                item.replaceWith(result.html);
            } else {
                // Create new
                $('#userlist tbody').append(result.html);
            }
        }
    }
}